#ifndef _SPORTSMAN_DATAACCESS_H_
#define _SPORTSMAN_DATAACCESS_H_

#include "Common.h"

#define     STR_SETTING_MAX_NUM     ("max_number")

#define     MAX_REPORT_TYPE         (14)

typedef struct DB_Version_t
{
    int main;
    int sub;
    int minor;
    int build;
}DB_VERSION;

interface IDataAccess
{
	virtual bool	Init() = 0;
	virtual bool	Close() = 0;

    virtual bool    GetVersion(DB_VERSION* pVer)=0;

	virtual bool	ChangePassword(const char* strName, const char* strPassword) = 0;
	virtual bool	AddAccount(const char* strName, const char* strPassword) = 0;
	virtual bool	CheckAccount(const char* strName, const char* strPassword) = 0;
	virtual bool	DeleteAccount(const char* strName) =0;
	virtual bool	SetAllAccount(CListViewCtrl* pCtrl)=0;

    virtual bool    Log(const char* strName, const char* strLog)=0;
    virtual bool    SetLogCtrl(int date,CListViewCtrl* pCtrl)=0;

	virtual bool    AddBasicInfo(Basic_Info_t* pInfo)= 0;
    virtual bool    UpdateBasicInfo(Basic_Info_t* pInfo)= 0;
    virtual bool    SetBasicInfoCtrl(const char* id, const char* name, CListViewCtrl* pCtrl)=0;
	virtual bool    SetBasicInfoCtrlEx(const char* id, const char* name,const char* native_place, const char* nationality,
								const char* mobile, const char* phone, const char* mail, CListViewCtrl* pCtrl)=0;
    virtual bool    GetBasicInfo(const char* id, Basic_Info_t* pInfo)=0;
    virtual bool    DeleteBasicInfo(const char* id)=0;

    virtual bool    AddStatusInfo(Status_Info_t* pInfo)=0;
    virtual bool    UpdateStatusInfo(Status_Info_t* pInfo)=0;
    virtual bool    GetStatusInfo(const char* id, Status_Info_t* pInfo)=0;
    virtual bool    DeleteStatusInfo(const char* id)=0;

	virtual bool	AddResultInfo(Result_Info_t* pInfo)= 0;
	virtual bool	UpdateResultInfo(Result_Info_t* pInfo)= 0;
	virtual bool	SetResultInfoCtrl(const char* id, CListViewCtrl* pCtrl)= 0;
	virtual bool	DeleteResultInfo(const char* id, int time)= 0;

    virtual bool    AddLoginInfo(Login_Info_t* pInfo) =0;
    virtual bool    UpdateLoginInfo(Login_Info_t* pInfo)=0;
    virtual bool    IsUserLogin(const char* id) = 0 ;
    virtual bool    SetLoginInfoCtrl(CListViewCtrl* pCtrl)=0;
    virtual bool    SetLoginInfoCtrl2(int date,CListViewCtrl* pCtrl)=0;

    virtual bool    AddImageInfo(const char* id, char* buf, int length, int width, int height) =0;
    virtual bool    UpdateImageInfo(const char* id, char* buf, int length, int width, int height)=0;
    virtual bool    GetImageInfo(const char* id, char* buf, int* pLength, int* pwidth, int* pheight)=0;
    virtual bool    DeleteImageInfo(const char* id)=0;

    virtual bool    GetSetting(const char* setting, int* value) =0;
    virtual bool    SetSetting(const char* setting, int value) =0;

    virtual bool    GetReport(const int type, const int year, const int quarter, const int month, int* result)=0;

};

IDataAccess*	GetDataAccess();

#endif

